home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / demos / zox3d15.arj / ZOX3D.DOC < prev    next >
Text File  |  1993-12-10  |  14KB  |  373 lines

  1.  
  2. Zox3D version 1.5
  3. by Robert Schmidt <robert@stud.unit.no>
  4. (C) Copyright 1993 of Ztiff Zox Softwear
  5.  
  6.  
  7.  
  8. Disclaimer:
  9. -----------
  10.  
  11. No warranty or guarantee of any kind whatsoever is provided regarding
  12. the software, the fitness of the software for any purpose, or the
  13. software quality or robustness.  The software consists of the
  14. executable(s), the data file(s), the source file(s), the documentation
  15. and the graphic file(s).
  16.  
  17. Under no circumstances is the author, named above, to be held
  18. responsible for consequential or inconsequential damage or any other
  19. incident arising from the use or abuse of any of the components of the
  20. software mentioned above.
  21.  
  22. Note that the source code is not made available with the standard demo
  23. distribution archive.
  24.  
  25. This software is put into the public domain.  This does not include
  26. the freedom to use the graphic images, which I might want to use in
  27. later products of my own.
  28.  
  29.  
  30.  
  31. General information:
  32. --------------------
  33.  
  34. Zox3D is a demonstration of the idea behind the 3D graphics
  35. engines in games like:
  36.  
  37.         Castle Wolfenstein 3D from Apogee/id
  38.         Ken's Labyrinth from Epic
  39.         Catacomb Abyss from Apogee
  40.         Dracula from Psygnosis
  41.  
  42. Also, there was a lot of talk about the $25,000 XOX library and its
  43. demo.  My goal was to develop a usable 3D game library which had all
  44. the essential features of XOX, and which would be a LOT cheaper...
  45. Well, there are missing features from Zox3D, most notably the lack of
  46. objects.  Thus, the sources (see below) should be taken only as an aid
  47. in understanding the principles of ray casting, as Zox3D is not a
  48. complete library of what you would want in a 3D maze game engine.
  49.  
  50. As will be obvious, this engine will by outclassed _by far_ when
  51. compared to the upcoming Doom from id software.  Doom has gotten rid of
  52. the square walls and flat levels.  Rooms can have (almost) any shape,
  53. walls can be at any angle around the y axis, floors and ceilings can be
  54. at any height and are movable.  This opens up for realistic scenarios
  55. with stairs and elevators.  Enough about Doom.
  56.  
  57. Currently only unchained (planar), 256-color VGA modes are supported in
  58. Zox3D, from 256x240 to 400x300.  Mode 13h and the likes are not 
  59. supported, because two or more pages are required for satisfactory 
  60. performance.  On fast computers, using a temporary buffer in 
  61. conventional memory and copying this to the video buffer might be an 
  62. alternative for die-hard mode 13h'ers, but this is not supported as of 
  63. yet.  16-color (EGA) modes are definite no-nos.
  64.  
  65.  
  66.  
  67. The sources:
  68. ------------
  69.  
  70. I am making the sources available for a modest sum of $100.  As a
  71. private hobbyist, this gives you the right to do anything with the
  72. source archive, except making it, or any part within, freely available.
  73. You can use any of the modules or individual functions in your own
  74. projects.  If you're going commercial, i.e. if you want to make
  75. money on your product, let me know, and we'll arrange something.
  76.  
  77. To compile Zox3D from scratch you will need Borland C++ 3.1 or 4.0, and
  78. Turbo Assembler 3.1 or later.
  79.  
  80. Make a check of $100 payable to "Robert Schmidt", and send it
  81. to the snail-mail address at the bottom.  When I receive it, I
  82. will mail you the sources, preferrably via e-mail.
  83.  
  84.  
  85.  
  86. Usage:
  87. ------
  88.  
  89. Zox3D requires a VGA and about 400 Kb of free DOS memory to run.  (I am
  90. not quite sure how much.)  The highest resolution requires a pretty
  91. capable monitor.  A mouse and a joystick are optional input devices,
  92. but the keyboard works OK.
  93.  
  94. When ZOX3D.EXE is executed, a menu of available screen modes will
  95. be offered.  Simply press the number in front of the mode you want, and
  96. you're off.  256x240 is the fastest, while 400x300 is the slowest.
  97. 400x300 might not work with your VGA monitor, due to the demanding
  98. horizontal sync timing.
  99.  
  100. After selecting a mode, a logo will appear, and a couple of seconds
  101. will be spent loading the graphics.  This will be really slow from
  102. diskette, so you would prefer to copy everything to a directory on
  103. your harddisk.  If the screen goes blank forever, simply press ESC to
  104. quit the demo, and try another mode.  If this doesn't help, send me
  105. a flaming mail with a few facts about the incident.
  106.  
  107. The following controls are currently functional in the demo.  Note that
  108. several keys pressed at once are detected correctly.  For example, you
  109. can walk and turn at the same time.
  110.  
  111. Mouse & keyboard:
  112.     Up - forward
  113.     Down - backwards
  114.     Left - turn left
  115.     Right - turn right
  116.  
  117. Keyboard:
  118.     Home - turn slow left
  119.     PgUp - turn slow right
  120.     End - move left
  121.     PgDn - move right
  122.     -/+ - move up/down
  123.  
  124.     ESC - quit demo
  125.     H - toggle help text on/off
  126.     F - toggle floor texturing on/off
  127.     S - toggle sky texturing on/off
  128.     ,/. - resize view window
  129.     J - recalibrate joystick
  130.  
  131. Mouse with right button pressed:
  132.     Up - move up (raise)
  133.     Down - move down (crouch)
  134.     Left - move left
  135.     Right - move right
  136.  
  137. Joystick A should work the way you expect it to.  Joystick B doesn't
  138. do anything.  I use my own autocalibrating driver, with a fairly large
  139. timeout value, so please let me know if it doesn't work.
  140.  
  141. Autocalibrating means that you calibrate the joystick in-play by moving
  142. the joystick to all the extremas (any two opposite corners are good
  143. enough).  Note that the joystick is polled only once each frame, so you
  144. might need to keep it still for a moment to make sure the extrema is
  145. registered (on a slow machine).
  146.  
  147. The joystick buttons don't do anything yet.  Hitting 'J' will reset the
  148. driver entirly, so you can plug in your joystick even after Zox3D is
  149. started, then recalibrate with 'J'.
  150.  
  151.  
  152.  
  153. Implementation notes:
  154. ---------------------
  155.  
  156. ZOX-3D is written in C/C++, except from the fixed point macros, the
  157. division by 0-handler, and the direct screen drawing routines.  The
  158. fixed point library was based on the one Michael Abrash introduced
  159. during his development of XSHARP.
  160.  
  161. A word about the inline assembly routines for wall drawing ---
  162. conditional defines are provided for enabling and disabling at wish:
  163.  
  164.     Inline assembly vs. pure C++, and
  165.     Static assembly code vs. self-modifying assembly code.
  166.  
  167. Thus, it is possibly to compile, link and run a C++-only version of
  168. Zox3D.  This is of course much slower than the self-modifying assembly,
  169. but the C++-code might prove valuable in the future, if Zox3D is to be
  170. ported, say, to a 32-bit protected mode environment.  It also
  171. helps providing an algorithmic explanation of the inline assembly.
  172.  
  173. At the moment, speed is not the main issue.  Rather, I'm working on
  174. adding as many effects as possible (transparency, moving bitmaps,
  175. etc.).  Eventually I might find the code stable enough to optimize the
  176. time critical code in pure assembler.  I don't think it will be worth
  177. it though.  Because of the new dimension added by mirrors and
  178. transparent walls, ZOX-3D is bound to have a lower frame rate than
  179. Wolf3D.
  180.  
  181. Textured floors and ceilings also make things much slower, as it is
  182. impossible to interpolate linearly through the bitmaps when drawing the
  183. floor/ceiling column by column.  If it weren't for the mirrors, the
  184. floor/ceiling could have been drawn line by line, which is potentially
  185. *much* faster.
  186.  
  187. The RESOURCE.DAT file is a text file describing the bitmaps used in the
  188. demo.  The first number is the number of bitmaps, then the bitmap
  189. descriptions follow, one on each line, in this format:
  190.  
  191. <width> <height> <type> <filename>
  192.  
  193. The bitmap used is cut from the file, as the rectangle with corners
  194. (0,0) and (width-1, height-1).  The type field is ignored in this
  195. version, but will tell the resource loader wether the bitmap is
  196. transparent, mirroring, or does some other effect.  Currently, only
  197. Deluxe Paint II Enhanced 256-color .LBM files are supported, and the
  198. resulting uncompressed raw data must be smaller than 64 Kb.  The .LBM
  199. files supplied with Zox3D are all 320x200 and use the same palette.
  200. The palette used in the demo is loaded from PAL.LBM.
  201.  
  202. A word about the LBM files.  DeLuxe Paint II Enhanced does something
  203. strange to the file if it is saved when a stencil is enabled.  DP2E
  204. reads it fine later, but I haven't been able to figure out why my
  205. decoding routines stop working on such files.  In short: turn of the
  206. stencils before saving.  I've had some spectacular crashes because of
  207. this.
  208.  
  209. As the Revision History below will tell, I have decided against further
  210. development of Zox3D, so no new features will be added.
  211.  
  212.  
  213. Known problems/bugs:
  214. --------------------
  215.  
  216.     Once in a while the tracing process fails by tracing
  217.     straight through a corner between two walls.  This might be due
  218.     to inaccuracies or a too-low resolution in the sin/cos-tables.
  219.     It happens when the ray is moving in an exact 45 degree line,
  220.     and hits the corner exactly.
  221.  
  222.     When moving along a wall with a slight angle away from it, the
  223.     collision detection routine will erronously detect a wall hit,
  224.     and turn you further away from the wall while pushing you back
  225.     a little.  A little annoying, but no real problem.
  226.  
  227.  
  228. Credits/hullo's:
  229. ----------------
  230.  
  231. Gerald Dalley (dalley@nes.nersc.gov) for interesting and helpful
  232.     discussions and sharing of experiences, as we developed
  233.     separate Wolf3D-like libraries concurrently.
  234.  
  235. Nigel Brooke (nigel@wimsey.com) for discussions on texture mapping of
  236.     the more general kind, and for helpful evaluation of early
  237.     Zox3D versions.
  238.  
  239. Dan Vasaru for knowing a lot about lots of things, and being generally
  240.     supportive.  Also greets to Per Arne, Arne-Dag, Terje, Terje,
  241.     Marius, Rolf, Jarle, Yngve, Eirik, Erik, Bj¢rn, ...
  242.  
  243. Christophe Meessen (Meessen@marvax.in2p3.fr),
  244. Torben Mogensen (torben@diku.dk) they both gave lots of help on making
  245.     fast sqrt() functions, even though I have no use for it Zox3D.
  246.     I thought I needed it though, so thanks, guys!
  247.  
  248. John Stanley (dracus@hebron.connected.com) for help on developing a
  249.     generic palette.
  250.  
  251. Lots of others from the (mostly) helpful lot in comp.lang.c++,
  252.     rec.games.programmer, and lots of other newsgroups.
  253.  
  254. The cool lot on IRC, including, but not limited too: babuu, BioHazard,
  255.     Clint, Croc, dux, eveso, Flie, Leinad, marfada9, Megafork, MSR,
  256.     NiceBruce, _NOR_, Nrrpf, Pusur, Slaughter, S-man, _TDK_, Thaco,
  257.     TheFaker, TheHard1, Tikes, XiaoPi, Zax ...
  258.  
  259.  
  260.  
  261. Demo history:
  262. -------------
  263.  
  264. Apr-93:
  265.     The Zox3D project was initialized.
  266.  
  267. Sep-93:
  268.     Started this log of history.
  269.  
  270.     Added assertions to 'new', so Zox3D should never hang if
  271.     available memory is too low.
  272.  
  273.     Reenabled the screen resolution menu.
  274.  
  275. Oct-93:
  276.     Resolution can be selected directly by providing ZOX3D.EXE with
  277.     the screen resolution number as a parameter.
  278.  
  279.     Walls are now lines seen from above, not Wolf3D-like blocks.
  280.  
  281.     Mirrors can now be covered by bitmaps, and transparent walls
  282.     are implemented.
  283.  
  284.     Collision detection to prevent player from walking into walls.
  285.  
  286. Nov-93:
  287.     Simple floor/ceiling (sky) texturing implemented (can be
  288.     toggled):
  289.      - slow
  290.      - bitmap limited to 64x64 (floor) and 256x256 (sky)
  291.      - one direction only
  292.      - reflects correctly in mirrors
  293.  
  294.     Made a moving sky with cool clouds above the maze.  This
  295.     clearly demonstrates that the sky is correctly mirrored.
  296.  
  297.     Simple help text implemented (can be toggled).
  298.  
  299.     I grabbed, without any permissions, a couple of bitmaps from:
  300.     Castle Wolfenstein 3D by id software, Jurassic Park by Ocean,
  301.     Windows 3.1 by Microsoft.  I will try to replace these with my
  302.     own as soon as possible.
  303.  
  304.     Fixed a problem with a bug in the initialization code of
  305.     MS MOUSE 9.0.
  306.  
  307.     Added a conditional define for enabling polling of any number
  308.     of keys at the same time - more arcade game like.  Took the
  309.     opportunity to add the Key and Keyboard classes.
  310.  
  311. 14-Nov-93:
  312.     Added joystick support with calibration, through classes
  313.     Gamecard and Joystick.
  314.  
  315.     Fixed most of the inaccuracies visible on the walls.
  316.  
  317.     Made it impossible (?) to walk through a wall, even at a
  318.     corner.  Let me know if you are still able to do it!
  319.  
  320.     Added keys , and . to modify the size of the view window.  The
  321.     window is positioned centered on the screen.
  322.  
  323.     Made the help text gradually change color.  I was hoping this
  324.     added to readability, but I'm not quite sure.
  325.  
  326. 16-Nov-93:
  327.     Added the option to compile C++-only, inline assembler, and
  328.     self-modifying assembler versions of Zox3D.
  329.  
  330. 25-Nov-93:
  331.     Fixed the inaccuracies in the walls, by calculating the
  332.     starting offset into the bitmap in a more accurate way.  The
  333.     walls now look as close to perfect as can be.
  334.  
  335. 1-Dec-93:
  336.     Upon notification from Gerald Dally, some of the self-modifying
  337.     code could be made static, while being potentially even faster.
  338.     (JMP instead of code modification + CALL/RET.)
  339.  
  340. 4-Dec-93:
  341.     Made all-new graphics to replace the ones I had ripped from
  342.     commercial products.
  343.  
  344. 5-Dec-93:
  345.     I decided against further development of Zox3D, in favour of a
  346.     more advanced, Doom-like engine, "Zoom3D"...:)  This means
  347.     that if objects are ever implemented for Zox3D, it won't be by
  348.     me.
  349.  
  350.     Added _CHAIN32.ASM to fix a bug in BC++ 4.0 which makes the RTL
  351.     version of _chain_intr() fail.
  352.  
  353.     Did some final cleanups.
  354.  
  355. 10-Dec-93:
  356.     Added a Ztiff Zox logo which has been lying around on my HD for
  357.     2 years.
  358.  
  359.  
  360. So long,
  361.  
  362. Robert Schmidt <robert@stud.unit.no>
  363. of Ztiff Zox Softwear
  364. [huh? you never heard of US??? :-)]
  365.  
  366. Snail mail address:
  367.  
  368. Robert Schmidt
  369. Stud. post 170
  370. NTH
  371. N-7034 Trondheim
  372. NORWAY
  373.